import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import React from 'react';
import TabBar from './Tabbar';
import SplashScreen from './SplashScreen';
import routes from './routes';

const MainStack = createNativeStackNavigator();

function App(): React.JSX.Element {
  return (
    <SplashScreen>
      <NavigationContainer>
        <MainStack.Navigator
          initialRouteName="Home"
          screenOptions={{animation: 'none'}}>
          <MainStack.Screen
            name="TabBar"
            component={TabBar}
            options={{headerShown: false}}
          />
          {routes.map(r => (
            <MainStack.Screen
              key={r.name}
              name={r.name}
              component={r.component}
              options={{headerShown: false}}
            />
          ))}
        </MainStack.Navigator>
      </NavigationContainer>
    </SplashScreen>
  );
}

export default App;
